<template>
    <div>
        <p>姓名：{{ user.name }}</p>
        <p>年龄：{{ user.age }}</p>
        <button @click="updateUserName('王五')">更新名字</button>
        <button >年龄增加</button>
    </div>
</template>


<script setup>
import { useUserStore } from '@/store/userStore';

const user=useUserStore()

const updateUserName=(newVal)=>{
    user.updateName(newVal)
}



</script>